/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { Request, Response } from 'express';
import { ResponseItem, responseSuccess } from '../utils';
import Mock from 'mockjs';

const { mock } = Mock;
export default {
  'POST /jdk/chain/list': (req: Request, res: Response) => {
    const data = mock({
      'list|1-30': [
        {
          id: '@id',
          user_id: '@id()',
          name: '@cword(5, 10)',
          phone: '13783636925',
          contact_phone: '13783636924',
          contact_name: '@cname(3)',
          created_at: '@date()',
          address: ['330000000000', '330100000000', '330105000000', '330105001000'],
          detail: '@county(true)',
          'sonCount|1-100': 100,
          province: '省',
          city: '市',
          district: '区',
          town: '街道',
          'is_black|1': ['0', '1'],
        },
      ],
    });

    let result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        ...data,
        total: data.list.length,
      },
    };
    return res.json(result);
  },
  'POST /jdk/chain/save': (req: Request, res: Response) => responseSuccess(req, res),
};
